/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.taobao.ibatiside.model.mapperv2.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.taobao.ibatiside.model.mapperv2.Mapperv2Package;
import org.taobao.ibatiside.model.mapperv2.ModeType;
import org.taobao.ibatiside.model.mapperv2.Parameter;
import org.taobao.ibatiside.model.mapperv2.ResultMap;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Parameter</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.taobao.ibatiside.model.mapperv2.impl.ParameterImpl#getJavaType <em>Java Type</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.mapperv2.impl.ParameterImpl#getJdbcType <em>Jdbc Type</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.mapperv2.impl.ParameterImpl#getMode <em>Mode</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.mapperv2.impl.ParameterImpl#getNullValue <em>Null Value</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.mapperv2.impl.ParameterImpl#getNumericScale <em>Numeric Scale</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.mapperv2.impl.ParameterImpl#getProperty <em>Property</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.mapperv2.impl.ParameterImpl#getResultMap <em>Result Map</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.mapperv2.impl.ParameterImpl#getTypeHandler <em>Type Handler</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.mapperv2.impl.ParameterImpl#getTypeName <em>Type Name</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ParameterImpl extends EObjectImpl implements Parameter {
	/**
	 * The default value of the '{@link #getJavaType() <em>Java Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getJavaType()
	 * @generated
	 * @ordered
	 */
	protected static final String JAVA_TYPE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getJavaType() <em>Java Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getJavaType()
	 * @generated
	 * @ordered
	 */
	protected String javaType = JAVA_TYPE_EDEFAULT;

	/**
	 * The default value of the '{@link #getJdbcType() <em>Jdbc Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getJdbcType()
	 * @generated
	 * @ordered
	 */
	protected static final String JDBC_TYPE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getJdbcType() <em>Jdbc Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getJdbcType()
	 * @generated
	 * @ordered
	 */
	protected String jdbcType = JDBC_TYPE_EDEFAULT;

	/**
	 * The default value of the '{@link #getMode() <em>Mode</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMode()
	 * @generated
	 * @ordered
	 */
	protected static final ModeType MODE_EDEFAULT = ModeType.IN;

	/**
	 * The cached value of the '{@link #getMode() <em>Mode</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMode()
	 * @generated
	 * @ordered
	 */
	protected ModeType mode = MODE_EDEFAULT;

	/**
	 * This is true if the Mode attribute has been set.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 * @ordered
	 */
	protected boolean modeESet;

	/**
	 * The default value of the '{@link #getNullValue() <em>Null Value</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNullValue()
	 * @generated
	 * @ordered
	 */
	protected static final String NULL_VALUE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getNullValue() <em>Null Value</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNullValue()
	 * @generated
	 * @ordered
	 */
	protected String nullValue = NULL_VALUE_EDEFAULT;

	/**
	 * The default value of the '{@link #getNumericScale() <em>Numeric Scale</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNumericScale()
	 * @generated
	 * @ordered
	 */
	protected static final Integer NUMERIC_SCALE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getNumericScale() <em>Numeric Scale</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNumericScale()
	 * @generated
	 * @ordered
	 */
	protected Integer numericScale = NUMERIC_SCALE_EDEFAULT;

	/**
	 * The default value of the '{@link #getProperty() <em>Property</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getProperty()
	 * @generated
	 * @ordered
	 */
	protected static final String PROPERTY_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getProperty() <em>Property</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getProperty()
	 * @generated
	 * @ordered
	 */
	protected String property = PROPERTY_EDEFAULT;

	/**
	 * The cached value of the '{@link #getResultMap() <em>Result Map</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getResultMap()
	 * @generated
	 * @ordered
	 */
	protected ResultMap resultMap;

	/**
	 * The default value of the '{@link #getTypeHandler() <em>Type Handler</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTypeHandler()
	 * @generated
	 * @ordered
	 */
	protected static final String TYPE_HANDLER_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getTypeHandler() <em>Type Handler</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTypeHandler()
	 * @generated
	 * @ordered
	 */
	protected String typeHandler = TYPE_HANDLER_EDEFAULT;

	/**
	 * The default value of the '{@link #getTypeName() <em>Type Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTypeName()
	 * @generated
	 * @ordered
	 */
	protected static final String TYPE_NAME_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getTypeName() <em>Type Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTypeName()
	 * @generated
	 * @ordered
	 */
	protected String typeName = TYPE_NAME_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ParameterImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return Mapperv2Package.Literals.PARAMETER;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getJavaType() {
		return javaType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setJavaType(String newJavaType) {
		String oldJavaType = javaType;
		javaType = newJavaType;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Mapperv2Package.PARAMETER__JAVA_TYPE, oldJavaType, javaType));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getJdbcType() {
		return jdbcType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setJdbcType(String newJdbcType) {
		String oldJdbcType = jdbcType;
		jdbcType = newJdbcType;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Mapperv2Package.PARAMETER__JDBC_TYPE, oldJdbcType, jdbcType));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ModeType getMode() {
		return mode;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMode(ModeType newMode) {
		ModeType oldMode = mode;
		mode = newMode == null ? MODE_EDEFAULT : newMode;
		boolean oldModeESet = modeESet;
		modeESet = true;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Mapperv2Package.PARAMETER__MODE, oldMode, mode, !oldModeESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void unsetMode() {
		ModeType oldMode = mode;
		boolean oldModeESet = modeESet;
		mode = MODE_EDEFAULT;
		modeESet = false;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.UNSET, Mapperv2Package.PARAMETER__MODE, oldMode, MODE_EDEFAULT, oldModeESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isSetMode() {
		return modeESet;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getNullValue() {
		return nullValue;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setNullValue(String newNullValue) {
		String oldNullValue = nullValue;
		nullValue = newNullValue;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Mapperv2Package.PARAMETER__NULL_VALUE, oldNullValue, nullValue));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Integer getNumericScale() {
		return numericScale;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setNumericScale(Integer newNumericScale) {
		Integer oldNumericScale = numericScale;
		numericScale = newNumericScale;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Mapperv2Package.PARAMETER__NUMERIC_SCALE, oldNumericScale, numericScale));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getProperty() {
		return property;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setProperty(String newProperty) {
		String oldProperty = property;
		property = newProperty;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Mapperv2Package.PARAMETER__PROPERTY, oldProperty, property));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ResultMap getResultMap() {
		return resultMap;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setResultMap(ResultMap newResultMap) {
		ResultMap oldResultMap = resultMap;
		resultMap = newResultMap;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Mapperv2Package.PARAMETER__RESULT_MAP, oldResultMap, resultMap));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getTypeHandler() {
		return typeHandler;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTypeHandler(String newTypeHandler) {
		String oldTypeHandler = typeHandler;
		typeHandler = newTypeHandler;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Mapperv2Package.PARAMETER__TYPE_HANDLER, oldTypeHandler, typeHandler));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getTypeName() {
		return typeName;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTypeName(String newTypeName) {
		String oldTypeName = typeName;
		typeName = newTypeName;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Mapperv2Package.PARAMETER__TYPE_NAME, oldTypeName, typeName));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case Mapperv2Package.PARAMETER__JAVA_TYPE:
				return getJavaType();
			case Mapperv2Package.PARAMETER__JDBC_TYPE:
				return getJdbcType();
			case Mapperv2Package.PARAMETER__MODE:
				return getMode();
			case Mapperv2Package.PARAMETER__NULL_VALUE:
				return getNullValue();
			case Mapperv2Package.PARAMETER__NUMERIC_SCALE:
				return getNumericScale();
			case Mapperv2Package.PARAMETER__PROPERTY:
				return getProperty();
			case Mapperv2Package.PARAMETER__RESULT_MAP:
				return getResultMap();
			case Mapperv2Package.PARAMETER__TYPE_HANDLER:
				return getTypeHandler();
			case Mapperv2Package.PARAMETER__TYPE_NAME:
				return getTypeName();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case Mapperv2Package.PARAMETER__JAVA_TYPE:
				setJavaType((String)newValue);
				return;
			case Mapperv2Package.PARAMETER__JDBC_TYPE:
				setJdbcType((String)newValue);
				return;
			case Mapperv2Package.PARAMETER__MODE:
				setMode((ModeType)newValue);
				return;
			case Mapperv2Package.PARAMETER__NULL_VALUE:
				setNullValue((String)newValue);
				return;
			case Mapperv2Package.PARAMETER__NUMERIC_SCALE:
				setNumericScale((Integer)newValue);
				return;
			case Mapperv2Package.PARAMETER__PROPERTY:
				setProperty((String)newValue);
				return;
			case Mapperv2Package.PARAMETER__RESULT_MAP:
				setResultMap((ResultMap)newValue);
				return;
			case Mapperv2Package.PARAMETER__TYPE_HANDLER:
				setTypeHandler((String)newValue);
				return;
			case Mapperv2Package.PARAMETER__TYPE_NAME:
				setTypeName((String)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case Mapperv2Package.PARAMETER__JAVA_TYPE:
				setJavaType(JAVA_TYPE_EDEFAULT);
				return;
			case Mapperv2Package.PARAMETER__JDBC_TYPE:
				setJdbcType(JDBC_TYPE_EDEFAULT);
				return;
			case Mapperv2Package.PARAMETER__MODE:
				unsetMode();
				return;
			case Mapperv2Package.PARAMETER__NULL_VALUE:
				setNullValue(NULL_VALUE_EDEFAULT);
				return;
			case Mapperv2Package.PARAMETER__NUMERIC_SCALE:
				setNumericScale(NUMERIC_SCALE_EDEFAULT);
				return;
			case Mapperv2Package.PARAMETER__PROPERTY:
				setProperty(PROPERTY_EDEFAULT);
				return;
			case Mapperv2Package.PARAMETER__RESULT_MAP:
				setResultMap((ResultMap)null);
				return;
			case Mapperv2Package.PARAMETER__TYPE_HANDLER:
				setTypeHandler(TYPE_HANDLER_EDEFAULT);
				return;
			case Mapperv2Package.PARAMETER__TYPE_NAME:
				setTypeName(TYPE_NAME_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case Mapperv2Package.PARAMETER__JAVA_TYPE:
				return JAVA_TYPE_EDEFAULT == null ? javaType != null : !JAVA_TYPE_EDEFAULT.equals(javaType);
			case Mapperv2Package.PARAMETER__JDBC_TYPE:
				return JDBC_TYPE_EDEFAULT == null ? jdbcType != null : !JDBC_TYPE_EDEFAULT.equals(jdbcType);
			case Mapperv2Package.PARAMETER__MODE:
				return isSetMode();
			case Mapperv2Package.PARAMETER__NULL_VALUE:
				return NULL_VALUE_EDEFAULT == null ? nullValue != null : !NULL_VALUE_EDEFAULT.equals(nullValue);
			case Mapperv2Package.PARAMETER__NUMERIC_SCALE:
				return NUMERIC_SCALE_EDEFAULT == null ? numericScale != null : !NUMERIC_SCALE_EDEFAULT.equals(numericScale);
			case Mapperv2Package.PARAMETER__PROPERTY:
				return PROPERTY_EDEFAULT == null ? property != null : !PROPERTY_EDEFAULT.equals(property);
			case Mapperv2Package.PARAMETER__RESULT_MAP:
				return resultMap != null;
			case Mapperv2Package.PARAMETER__TYPE_HANDLER:
				return TYPE_HANDLER_EDEFAULT == null ? typeHandler != null : !TYPE_HANDLER_EDEFAULT.equals(typeHandler);
			case Mapperv2Package.PARAMETER__TYPE_NAME:
				return TYPE_NAME_EDEFAULT == null ? typeName != null : !TYPE_NAME_EDEFAULT.equals(typeName);
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (javaType: ");
		result.append(javaType);
		result.append(", jdbcType: ");
		result.append(jdbcType);
		result.append(", mode: ");
		if (modeESet) result.append(mode); else result.append("<unset>");
		result.append(", nullValue: ");
		result.append(nullValue);
		result.append(", numericScale: ");
		result.append(numericScale);
		result.append(", property: ");
		result.append(property);
		result.append(", typeHandler: ");
		result.append(typeHandler);
		result.append(", typeName: ");
		result.append(typeName);
		result.append(')');
		return result.toString();
	}

} //ParameterImpl
